using System;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public class image_class
{
	public precolor_range_class precolor_range;

	public bool settings_foldout;

	public int image_number;

	public List<Texture2D> image;

	public Texture2D texture;

	public bool tile_offset;

	public Color image_color;

	public AnimationCurve image_curve;

	public bool splatmap;

	public bool includeAlpha;

	public bool flip_x;

	public bool flip_y;

	public bool clamp;

	public int list_length;

	public int list_row;

	public list_condition_enum image_list_mode;

	public image_mode_enum image_mode;

	public select_mode_enum select_mode;

	public int import_max_size;

	public int import_max_size_list;

	public bool short_list;

	public bool image_auto_scale;

	public Vector2 conversion_step;

	public float tile_x;

	public float tile_y;

	public float tile_offset_x;

	public float tile_offset_y;

	public bool rgb;

	public bool rotation;

	public float rotation_value;

	public bool output;

	public float output_pos;

	public float output_alpha;

	public bool edge_blur;

	public float edge_blur_radius;

	public float alpha;

	public auto_search_class auto_search;

	public image_class()
	{
		precolor_range = new precolor_range_class(0, one_color1: false);
		image = new List<Texture2D>();
		image_color = Color.white;
		includeAlpha = true;
		list_length = 1;
		list_row = 4;
		image_auto_scale = true;
		conversion_step = new Vector2(1f, 1f);
		tile_x = 1f;
		tile_y = 1f;
		rgb = true;
		edge_blur_radius = 1f;
		auto_search = new auto_search_class();
		image.Add(texture);
		auto_search.extension = ".png";
	}

	public void set_image_auto_tile(terrain_class preterrain)
	{
	}

	public void adjust_list()
	{
		int num = list_length - image.Count;
		int num2 = default(int);
		if (num > 0)
		{
			for (num2 = 0; num2 < num; num2++)
			{
				image.Add(new Texture2D(1, 1));
			}
		}
		if (num < 0)
		{
			num *= -1;
			for (num2 = 0; num2 < num; num2++)
			{
				image.RemoveAt(image.Count - 1);
			}
		}
	}

	public void set_image_auto_scale(terrain_class preterrain1, Rect area, int image_number)
	{
		if (image_number >= image.Count || !image[image_number] || preterrain1 == null)
		{
			return;
		}
		if (image_mode == image_mode_enum.Area)
		{
			conversion_step.x = area.width / (float)(image[image_number].width - 1);
			conversion_step.y = area.height / (float)(image[image_number].height - 1);
		}
		else if (image_mode == image_mode_enum.Terrain)
		{
			if ((bool)preterrain1.terrain)
			{
				ref Vector2 reference = ref conversion_step;
				Vector3 size = preterrain1.terrain.terrainData.size;
				reference.x = size.x / (float)(image[image_number].width - 1);
				ref Vector2 reference2 = ref conversion_step;
				Vector3 size2 = preterrain1.terrain.terrainData.size;
				reference2.y = size2.z / (float)(image[image_number].height - 1);
			}
		}
		else if (image_mode == image_mode_enum.MultiTerrain)
		{
			ref Vector2 reference3 = ref conversion_step;
			Vector3 size3 = preterrain1.terrain.terrainData.size;
			reference3.x = size3.x * preterrain1.tiles.x / (float)(image[image_number].width - 1);
			ref Vector2 reference4 = ref conversion_step;
			Vector3 size4 = preterrain1.terrain.terrainData.size;
			reference4.y = size4.z * preterrain1.tiles.y / (float)(image[image_number].height - 1);
		}
	}
}
